#ifndef __BSP_AHT21_DRIVER_H
#define __BSP_AHT21_DRIVER_H

#include "iic_hal.h"


/*上层iic接口 */
typedef struct{
    uint8_t         (*pfiic_init)();
    uint8_t         (*pfiic_deinit)();
    void            (*pfiic_start)(iic_bus_t *bus);
    void            (*pfiic_stop)(iic_bus_t *bus);
    uint8_t         (*pfiic_wait_ack)(iic_bus_t *bus);
    void            (*pfiic_send_ack)(iic_bus_t *bus);
    void            (*pfiic_send_no_ack)(iic_bus_t *bus);
    void            (*pfiic_send_byte)(iic_bus_t *bus, unsigned char cSendByte);
    uint8_t         (*pfiic_receive_byte)(iic_bus_t *bus);

}iic_driver_interface_t;

/*上层时基接口 */
typedef struct{
    uint32_t (*pfGetTick)(void);
}timebase_interface_t;

/*上层操作系统延时函数 */
typedef struct{
    //操作系统延时函数
    void (*rtos_yield)(uint32_t ms);
    //void (*os_delay_ms)(uint32_t ms);
}yield_interface_t;

/*集合结构体*/
typedef struct{

    uint32_t id;  //设备id

    iic_driver_interface_t  *psiic_interface;
    timebase_interface_t    *pssys_tick;
    yield_interface_t       *psyield_interface;

    //本层函数
    uint8_t (*pfAHT_Read_Status)(void);
    void    (*pfAHT_Reset)(void);
    uint8_t (*pfAHT_Init)(void);
    uint8_t (*pfAHT_Read)(float *humi, float *temp);

}bsp_aht21_driver_t;

//构造函数
void  initStr( bsp_aht21_driver_t        *bsp_aht21_driver, 
               iic_driver_interface_t    *iic_interface,
               timebase_interface_t      *sys_tick,
               iic_bus_t                 *iic_bus);


#endif
